package com.dhcc.bpm.business.papc.service.impl;

//import com.baomidou.dynamic.datasource.annotation.DS;
import com.dhcc.bpm.business.papc.entity.FtpInfoConfig;
import com.dhcc.bpm.business.papc.vo.FtpInfoConfigVO;
import com.dhcc.bpm.business.papc.mapper.FtpInfoConfigMapper;
import com.dhcc.bpm.business.papc.service.IFtpInfoConfigService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.util.StringUtils;
import java.util.List;

/**
 * FTP参数表  服务实现类
 *
 * @author liuzhao
 * @since 2020-05-16
 */
@Service
//@DS("slave")
public class FtpInfoConfigServiceImpl extends BaseServiceImpl<FtpInfoConfigMapper, FtpInfoConfig> implements IFtpInfoConfigService {

    @Override
    public IPage<FtpInfoConfigVO> selectFtpInfoConfigPage(IPage<FtpInfoConfigVO> page, FtpInfoConfigVO ftpInfo) {
        return page.setRecords(baseMapper.selectFtpInfoConfigPage(page, ftpInfo));
    }

    @Override
    public FtpInfoConfig selectFtpInfoConfigById(Long id) {
        return baseMapper.selectFtpInfoConfigById(id);
    }

    @Override
    public boolean saveOrUpdate(FtpInfoConfig ftpInfoConfig) {
        int result;
        if (StringUtils.isEmpty(ftpInfoConfig.getId())) {
            result = baseMapper.save(ftpInfoConfig);
        } else {
        	ftpInfoConfig.setFtpInfoConfigKey(ftpInfoConfig.getId().toString());
            result = baseMapper.update(ftpInfoConfig);
        }
        return result >= 1;
    }

    @Override
    public boolean deleteFtpInfoConfigByIds(String ids) {
        int result = baseMapper.deleteFtpInfoConfigByIds(ids.split(","));
        return result >= 1;
    }

    @Override
    public List<FtpInfoConfig> selectFtpInfoConfigAll(FtpInfoConfig ftpInfoConfig) {
        return baseMapper.selectFtpInfoConfigAll(ftpInfoConfig);
    }

}
